#include <cstdio>
const int maxn = 5010;
int n, m, p, x, y;
int f[maxn];
int findf(int k){
	if(f[k] == 0) return k;
	return findf(f[k]);
}
int main(){
	scanf("%d%d%d", &n, &m, &p);
	for(int i = 0; i < m; i++){
		scanf("%d%d", &x, &y);
		int fx = findf(x), fy = findf(y);
		if(fx != fy) f[fx] = fy;
	}
	for(int i = 0; i < p; i++){
		scanf("%d%d", &x, &y);
		int fx = findf(x), fy = findf(y);
		if(fx == fy) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}
